/****************************************************************
 * <strong>MFXFilter</strong>
 *
 * <p>
 * MFXFilter
 * </p>
 *
 * @author AndyZhang 2011
 * @version 0.1
 * ToDo:
 ***************************************************************/

package com.thinkwide.data.filter;

import com.thinkwide.data.debug.MFDebug;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class MFXFilter implements Filter {

    public void destroy() {
        // TODO Auto-generated method stub

    }

    public static ThreadLocal<HttpServletRequest> threadRequestLocal = new ThreadLocal<HttpServletRequest>();
    public static ThreadLocal<HttpServletResponse> threadResponseLocal = new ThreadLocal<HttpServletResponse>();

    public void doFilter(ServletRequest request, ServletResponse response,
                         FilterChain chain) throws IOException, ServletException {

        threadRequestLocal.set((HttpServletRequest) request);
        threadResponseLocal.set((HttpServletResponse) response);

        chain.doFilter(request, response);


    }

    public void init(FilterConfig config) throws ServletException {
        // TODO Auto-generated method stub
        MFDebug.println("启动后台自动过滤器服务...");
    }

}
